; ModuleID = 'worlk_in_group02.c'
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i386-pc-linux-gnu"

%struct.MPI_Status = type { i32, i32, i32, i32, i32 }
%struct.ompi_communicator_t = type opaque
%struct.ompi_datatype_t = type opaque
%struct.ompi_predefined_communicator_t = type opaque
%struct.ompi_predefined_datatype_t = type opaque

@C.0.4943 = private constant [4 x [4 x float]] [[4 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00], [4 x float] [float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, float 8.000000e+00], [4 x float] [float 9.000000e+00, float 1.000000e+01, float 1.100000e+01, float 1.200000e+01], [4 x float] [float 1.300000e+01, float 1.400000e+01, float 1.500000e+01, float 1.600000e+01]] ; <[4 x [4 x float]]*> [#uses=1]
@ompi_mpi_comm_world = external global %struct.ompi_predefined_communicator_t ; <%struct.ompi_predefined_communicator_t*> [#uses=1]
@ompi_mpi_float = external global %struct.ompi_predefined_datatype_t ; <%struct.ompi_predefined_datatype_t*> [#uses=1]
@.str = private constant [37 x i8] c"rank= %d b= %3.1f %3.1f %3.1f %3.1f\0A\00", align 1 ; <[37 x i8]*> [#uses=1]
@.str1 = private constant [42 x i8] c"Must specify %d processors. Terminating.\0A\00", align 1 ; <[42 x i8]*> [#uses=1]

define i32 @main(i32 %argc, i8** %argv) nounwind {
entry:
  %argc_addr = alloca i32                         ; <i32*> [#uses=2]
  %argv_addr = alloca i8**                        ; <i8***> [#uses=2]
  %retval = alloca i32                            ; <i32*> [#uses=1]
  %columntype = alloca %struct.ompi_datatype_t*   ; <%struct.ompi_datatype_t**> [#uses=3]
  %stat = alloca %struct.MPI_Status               ; <%struct.MPI_Status*> [#uses=1]
  %b = alloca [4 x float]                         ; <[4 x float]*> [#uses=5]
  %a = alloca [4 x [4 x float]]                   ; <[4 x [4 x float]]*> [#uses=2]
  %i = alloca i32                                 ; <i32*> [#uses=6]
  %tag = alloca i32                               ; <i32*> [#uses=3]
  %dest = alloca i32                              ; <i32*> [#uses=0]
  %source = alloca i32                            ; <i32*> [#uses=2]
  %rank = alloca i32                              ; <i32*> [#uses=3]
  %numtasks = alloca i32                          ; <i32*> [#uses=3]
  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
  store i32 %argc, i32* %argc_addr
  store i8** %argv, i8*** %argv_addr
  store i32 0, i32* %source, align 4
  store i32 1, i32* %tag, align 4
  %a1 = bitcast [4 x [4 x float]]* %a to i8*      ; <i8*> [#uses=1]
  call void @llvm.memcpy.i32(i8* %a1, i8* bitcast ([4 x [4 x float]]* @C.0.4943 to i8*), i32 64, i32 4)
  %0 = call i32 @MPI_Init(i32* %argc_addr, i8*** %argv_addr) nounwind ; <i32> [#uses=0]
  %1 = call i32 @MPI_Comm_rank(%struct.ompi_communicator_t* bitcast (%struct.ompi_predefined_communicator_t* @ompi_mpi_comm_world to %struct.ompi_communicator_t*), i32* %rank) nounwind ; <i32> [#uses=0]
  %2 = call i32 @MPI_Comm_size(%struct.ompi_communicator_t* bitcast (%struct.ompi_predefined_communicator_t* @ompi_mpi_comm_world to %struct.ompi_communicator_t*), i32* %numtasks) nounwind ; <i32> [#uses=0]
  %3 = call i32 @MPI_Type_vector(i32 4, i32 1, i32 4, %struct.ompi_datatype_t* bitcast (%struct.ompi_predefined_datatype_t* @ompi_mpi_float to %struct.ompi_datatype_t*), %struct.ompi_datatype_t** %columntype) nounwind ; <i32> [#uses=0]
  %4 = call i32 @MPI_Type_commit(%struct.ompi_datatype_t** %columntype) nounwind ; <i32> [#uses=0]
  %5 = load i32* %numtasks, align 4               ; <i32> [#uses=1]
  %6 = icmp eq i32 %5, 4                          ; <i1> [#uses=1]
  br i1 %6, label %bb, label %bb8

bb:                                               ; preds = %entry
  %7 = load i32* %rank, align 4                   ; <i32> [#uses=1]
  %8 = icmp eq i32 %7, 0                          ; <i1> [#uses=1]
  br i1 %8, label %bb2, label %bb5

bb2:                                              ; preds = %bb
  store i32 0, i32* %i, align 4
  br label %bb4

bb3:                                              ; preds = %bb4
  %9 = load %struct.ompi_datatype_t** %columntype, align 4 ; <%struct.ompi_datatype_t*> [#uses=1]
  %10 = load i32* %i, align 4                     ; <i32> [#uses=1]
  %11 = getelementptr inbounds [4 x [4 x float]]* %a, i32 0, i32 0 ; <[4 x float]*> [#uses=1]
  %12 = getelementptr inbounds [4 x float]* %11, i32 0, i32 %10 ; <float*> [#uses=1]
  %13 = bitcast float* %12 to i8*                 ; <i8*> [#uses=1]
  %14 = load i32* %i, align 4                     ; <i32> [#uses=1]
  %15 = load i32* %tag, align 4                   ; <i32> [#uses=1]
  %16 = call i32 @MPI_Send(i8* %13, i32 1, %struct.ompi_datatype_t* %9, i32 %14, i32 %15, %struct.ompi_communicator_t* bitcast (%struct.ompi_predefined_communicator_t* @ompi_mpi_comm_world to %struct.ompi_communicator_t*)) nounwind ; <i32> [#uses=0]
  %17 = load i32* %i, align 4                     ; <i32> [#uses=1]
  %18 = add nsw i32 %17, 1                        ; <i32> [#uses=1]
  store i32 %18, i32* %i, align 4
  br label %bb4

bb4:                                              ; preds = %bb3, %bb2
  %19 = load i32* %numtasks, align 4              ; <i32> [#uses=1]
  %20 = load i32* %i, align 4                     ; <i32> [#uses=1]
  %21 = icmp slt i32 %20, %19                     ; <i1> [#uses=1]
  br i1 %21, label %bb3, label %bb5

bb5:                                              ; preds = %bb4, %bb
  %b6 = bitcast [4 x float]* %b to float*         ; <float*> [#uses=1]
  %b67 = bitcast float* %b6 to i8*                ; <i8*> [#uses=1]
  %22 = load i32* %source, align 4                ; <i32> [#uses=1]
  %23 = load i32* %tag, align 4                   ; <i32> [#uses=1]
  %24 = call i32 @MPI_Recv(i8* %b67, i32 4, %struct.ompi_datatype_t* bitcast (%struct.ompi_predefined_datatype_t* @ompi_mpi_float to %struct.ompi_datatype_t*), i32 %22, i32 %23, %struct.ompi_communicator_t* bitcast (%struct.ompi_predefined_communicator_t* @ompi_mpi_comm_world to %struct.ompi_communicator_t*), %struct.MPI_Status* %stat) nounwind ; <i32> [#uses=0]
  %25 = getelementptr inbounds [4 x float]* %b, i32 0, i32 3 ; <float*> [#uses=1]
  %26 = load float* %25, align 4                  ; <float> [#uses=1]
  %27 = fpext float %26 to double                 ; <double> [#uses=1]
  %28 = getelementptr inbounds [4 x float]* %b, i32 0, i32 2 ; <float*> [#uses=1]
  %29 = load float* %28, align 4                  ; <float> [#uses=1]
  %30 = fpext float %29 to double                 ; <double> [#uses=1]
  %31 = getelementptr inbounds [4 x float]* %b, i32 0, i32 1 ; <float*> [#uses=1]
  %32 = load float* %31, align 4                  ; <float> [#uses=1]
  %33 = fpext float %32 to double                 ; <double> [#uses=1]
  %34 = getelementptr inbounds [4 x float]* %b, i32 0, i32 0 ; <float*> [#uses=1]
  %35 = load float* %34, align 4                  ; <float> [#uses=1]
  %36 = fpext float %35 to double                 ; <double> [#uses=1]
  %37 = load i32* %rank, align 4                  ; <i32> [#uses=1]
  %38 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds ([37 x i8]* @.str, i32 0, i32 0), i32 %37, double %36, double %33, double %30, double %27) nounwind ; <i32> [#uses=0]
  br label %bb9

bb8:                                              ; preds = %entry
  %39 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds ([42 x i8]* @.str1, i32 0, i32 0), i32 4) nounwind ; <i32> [#uses=0]
  br label %bb9

bb9:                                              ; preds = %bb8, %bb5
  %40 = call i32 @MPI_Finalize() nounwind         ; <i32> [#uses=0]
  br label %return

return:                                           ; preds = %bb9
  %retval10 = load i32* %retval                   ; <i32> [#uses=1]
  ret i32 %retval10
}

declare void @llvm.memcpy.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind

declare i32 @MPI_Init(i32*, i8***)

declare i32 @MPI_Comm_rank(%struct.ompi_communicator_t*, i32*)

declare i32 @MPI_Comm_size(%struct.ompi_communicator_t*, i32*)

declare i32 @MPI_Type_vector(i32, i32, i32, %struct.ompi_datatype_t*, %struct.ompi_datatype_t**)

declare i32 @MPI_Type_commit(%struct.ompi_datatype_t**)

declare i32 @MPI_Send(i8*, i32, %struct.ompi_datatype_t*, i32, i32, %struct.ompi_communicator_t*)

declare i32 @MPI_Recv(i8*, i32, %struct.ompi_datatype_t*, i32, i32, %struct.ompi_communicator_t*, %struct.MPI_Status*)

declare i32 @printf(i8* noalias, ...) nounwind

declare i32 @MPI_Finalize()
